const { sequelize } = require('../config/db');
const { DataTypes } = require('sequelize');

//定义视频模型
const Video = sequelize.define('Video', {
  id: {
    type: DataTypes.INTEGER,
    primaryKey: true,
    autoIncrement: true
  },
  title: {
    type: DataTypes.STRING,
    allowNull: false //禁止空值
  },
  url: {
    type: DataTypes.STRING,
  },
  source: {
    type: DataTypes.STRING,
    allowNull: false
  },
  category: {
    type: DataTypes.STRING,
    allowNull: false
  },
  duration: {
    type: DataTypes.STRING,
  },
  poster: {
    type: DataTypes.STRING,
    allowNull: false
  }
},
  {
    tableName: 'videos',
    comment: '视频列表',
    indexes:[]
  })

module.exports = { Video };